//
//  ViewController.m
//  ShareDemo
//
//  Created by Li Zhiping on 13-11-20.
//  Copyright (c) 2013年 Li Zhiping. All rights reserved.
//

#import "ViewController.h"
#import "LGSinaAccount.h"
#import "LGShareAccount.h"
#import "LGSinaShare.h"
#import "LGShareSDK.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
	// Do any additional setup after loading the view, typically from a nib.
}

- (IBAction)authorBtnClicked:(id)sender{
    [LGSinaShare author];
}

- (IBAction)shareBtnClicked:(id)sender{
    LGShareContent *content = [LGShareContent instance];
    content.content = @"测试测试测试啦";
    content.url = nil;
    [LGSinaShare shareContent:content complete:^(LGResponseState state, LGShareContent *status, LGErrorInfo *error){
        if (state == LGResponseStateSuccess) {
            UIAlertView *alert = [[UIAlertView alloc] initWithTitle:nil message:@"分享成功" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
            [alert show];
        }
    }];
}

- (IBAction)sharePhotoWeibo:(id)sender{
    LGShareContent *content = [LGShareContent instance];
    content.content = @"这是一条图片新闻, 里面有个五角星";
    content.url = nil;
    content.image = [UIImage imageNamed:@"favorited.png"];
    [LGSinaShare shareContent:content complete:^(LGResponseState state, LGShareContent *status, LGErrorInfo *error){
        if (state == LGResponseStateSuccess) {
            UIAlertView *alert = [[UIAlertView alloc] initWithTitle:nil message:@"分享成功" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
            [alert show];
        }
    }];
}

- (IBAction)logoutBtnClicked:(id)sender{
    [LGSinaShare logout];
}

- (IBAction)fetchFriendList:(id)sender{
    LGFriendsContent *content = [LGFriendsContent contentWith:3 cursou:3];
    [LGSinaShare fetchFriendShip:content complete:^(LGResponseState state, NSArray *users, long long curr, long long prev, long long next, BOOL hasNext, NSDictionary *extInfo, LGErrorInfo *error){
        NSLog(@"%@",users);
    }];
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
